import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    showdata: 1,
    selectid: '1-4-3',
    HomeNavid: '1',

    List: {
      '1-4-2': [
        { name: '开场问候', key: '1' },
        { name: '保养预约', key: '2' },
        { name: '预约邀请与时间确认', key: '3' },
        { name: '异议处理', key: '4' },
      ],
      '1-4-3': [
        { name: '客户类型（一）', key: '1' },
        { name: '客户类型（二）', key: '2' },
      ],
    },
    resultdata: {},
  },
  mutations: {
    Checkid: (state, payload) => {
      state.selectid = payload.id;
    },
    CheckNavid: (state, payload) => {
      state.HomeNavid = payload.id;
      if (payload.id == 3) {
        state.selectid = '3-4-1';
      }
      if (payload.id == 1) {
        state.selectid = '1-4-2';
      }
    },
    setResultdata: (state, payload) => {
      state.resultdata = payload;
    },
    checkShowdata: (state, payload) => {
      state.showdata = payload;
    },
  },
  actions: {},
  getters: {
    selectData: state => {
      if (state.selectid == '1-4-1') {
        return [];
      }
      return state.List[state.selectid];
    },
  },
  modules: {},
});
